package com.juku2024.juku.tools

import com.orhanobut.logger.AndroidLogAdapter
import com.orhanobut.logger.Logger
import com.orhanobut.logger.PrettyFormatStrategy
import com.juku2024.juku.BuildConfig


object LogC {

    fun init() {
        if (!BuildConfig.DEBUG) return
        val channel = "dayVideo"
        val formatStrategy = PrettyFormatStrategy.newBuilder()
            .showThreadInfo(false)  // (Optional) Whether to show thread info or not. Default true
            .tag(channel)   // (Optional) Global tag for every log. Default PRETTY_LOGGER
            .methodCount(0)         // (Optional) How many method line to show. Default 2
            .methodOffset(7)
            .build()
        Logger.addLogAdapter(object : AndroidLogAdapter(formatStrategy) {
            override fun isLoggable(priority: Int, tag: String?): Boolean {
                return BuildConfig.DEBUG
            }
        })
    }

    fun e(obj: Any) {
        if (!BuildConfig.DEBUG) return
        Logger.e(obj.toString())
    }

    fun d(obj: Any) {
        if (!BuildConfig.DEBUG) return
        Logger.d(obj.toString())
    }

}